package leetcode.stack_queue;

import java.util.ArrayDeque;

public class RecentCounter {

    ArrayDeque<Integer> queue = new ArrayDeque<>();
    public RecentCounter() {}
    public int ping(int t) {
        queue.offerLast(t);
        int minVal = t - 3000;
        while (queue.peekFirst() < minVal)
            queue.pollFirst();
        return queue.size();
    }


}
